/**
 * 
 */
package com.sci.web.action.datareportseason.innovatebase;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.bean.Enterprise_Funds;
import com.sci.web.dao.DataReportM_InnovateBaseDao;

/**
 * @author  BaiFuyou
 * @date: Nov 7, 2011 7:34:16 PM
 * 
 * 更新数据
 */
public class UpdateInnovateBaseData_ResearchMoney extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5794768958295133054L;
	private String f_id;
	private String s_id;
	private String t_id;
	private String f_sale;
	private String f_tech;
	private String f_invest;
	private String f_research;
	private String s_sale;
	private String s_tech;
	private String s_invest;
	private String s_research;
	private String t_sale;
	private String t_tech;
	private String t_invest;
	private String t_research;
	private int funds_intensity;
	@Resource
	private DataReportM_InnovateBaseDao dataReportM_InnovateBaseDao;
	/**
	 * @return the f_id
	 */
	public String getF_id() {
		return f_id;
	}
	/**
	 * @param f_id the f_id to set
	 */
	public void setF_id(String f_id) {
		this.f_id = f_id;
	}
	/**
	 * @return the s_id
	 */
	public String getS_id() {
		return s_id;
	}
	/**
	 * @param s_id the s_id to set
	 */
	public void setS_id(String s_id) {
		this.s_id = s_id;
	}
	/**
	 * @return the t_id
	 */
	public String getT_id() {
		return t_id;
	}
	/**
	 * @param t_id the t_id to set
	 */
	public void setT_id(String t_id) {
		this.t_id = t_id;
	}
	/**
	 * @return the f_sale
	 */
	public String getF_sale() {
		return f_sale;
	}
	/**
	 * @param f_sale the f_sale to set
	 */
	public void setF_sale(String f_sale) {
		this.f_sale = f_sale;
	}
	/**
	 * @return the f_tech
	 */
	public String getF_tech() {
		return f_tech;
	}
	/**
	 * @param f_tech the f_tech to set
	 */
	public void setF_tech(String f_tech) {
		this.f_tech = f_tech;
	}
	/**
	 * @return the f_invest
	 */
	public String getF_invest() {
		return f_invest;
	}
	/**
	 * @param f_invest the f_invest to set
	 */
	public void setF_invest(String f_invest) {
		this.f_invest = f_invest;
	}
	/**
	 * @return the f_research
	 */
	public String getF_research() {
		return f_research;
	}
	/**
	 * @param f_research the f_research to set
	 */
	public void setF_research(String f_research) {
		this.f_research = f_research;
	}
	/**
	 * @return the s_sale
	 */
	public String getS_sale() {
		return s_sale;
	}
	/**
	 * @param s_sale the s_sale to set
	 */
	public void setS_sale(String s_sale) {
		this.s_sale = s_sale;
	}
	/**
	 * @return the s_tech
	 */
	public String getS_tech() {
		return s_tech;
	}
	/**
	 * @param s_tech the s_tech to set
	 */
	public void setS_tech(String s_tech) {
		this.s_tech = s_tech;
	}
	/**
	 * @return the s_invest
	 */
	public String getS_invest() {
		return s_invest;
	}
	/**
	 * @param s_invest the s_invest to set
	 */
	public void setS_invest(String s_invest) {
		this.s_invest = s_invest;
	}
	/**
	 * @return the s_research
	 */
	public String getS_research() {
		return s_research;
	}
	/**
	 * @param s_research the s_research to set
	 */
	public void setS_research(String s_research) {
		this.s_research = s_research;
	}
	/**
	 * @return the t_sale
	 */
	public String getT_sale() {
		return t_sale;
	}
	/**
	 * @param t_sale the t_sale to set
	 */
	public void setT_sale(String t_sale) {
		this.t_sale = t_sale;
	}
	/**
	 * @return the t_tech
	 */
	public String getT_tech() {
		return t_tech;
	}
	/**
	 * @param t_tech the t_tech to set
	 */
	public void setT_tech(String t_tech) {
		this.t_tech = t_tech;
	}
	/**
	 * @return the t_invest
	 */
	public String getT_invest() {
		return t_invest;
	}
	/**
	 * @param t_invest the t_invest to set
	 */
	public void setT_invest(String t_invest) {
		this.t_invest = t_invest;
	}
	/**
	 * @return the t_research
	 */
	public String getT_research() {
		return t_research;
	}
	/**
	 * @param t_research the t_research to set
	 */
	public void setT_research(String t_research) {
		this.t_research = t_research;
	}
	/**
	 * @return the funds_intensity
	 */
	public int getFunds_intensity() {
		return funds_intensity;
	}
	/**
	 * @param funds_intensity the funds_intensity to set
	 */
	public void setFunds_intensity(int funds_intensity) {
		this.funds_intensity = funds_intensity;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		super.setContentType(super.JSON);
		this.dataReportM_InnovateBaseDao.updateEnterprise_Funds(getEnterprise_Funds(f_id, f_sale, f_tech, f_invest, f_research, funds_intensity));
		this.dataReportM_InnovateBaseDao.updateEnterprise_Funds(getEnterprise_Funds(s_id, f_sale, s_tech, s_invest, s_research, funds_intensity));
		this.dataReportM_InnovateBaseDao.updateEnterprise_Funds(getEnterprise_Funds(t_id, f_sale, t_tech, t_invest, t_research, funds_intensity));
		super.outPrint("ok");
		return "json";
	}
	public Enterprise_Funds getEnterprise_Funds(String id,String sale,String tech,String invest,String research,int funds_intensity){
		Enterprise_Funds ef = new Enterprise_Funds();
		ef.setFunds_id(Integer.parseInt(id.substring(id.indexOf("_")+1, id.length())));
		ef.setFunds_base_investment(Double.parseDouble(invest.substring(invest.indexOf("_")+1, invest.length())));
		ef.setFunds_income(Double.parseDouble(sale.substring(sale.indexOf("_")+1, sale.length())));
		ef.setFunds_technology_investment(Double.parseDouble(tech.substring(tech.indexOf("_")+1, tech.length())));
		ef.setFunds_research_investment(Double.parseDouble(research.substring(research.indexOf("_")+1, research.length())));
		ef.setFunds_intensity(funds_intensity);
		ef.setFunds_ratio(Double.parseDouble(research.substring(research.indexOf("_")+1, research.length()))/Double.parseDouble(sale.substring(sale.indexOf("_")+1, sale.length())));
		return ef;
	}
}
